var dragEle = null
var eleX = 0
var eleY = 0
var mouseX = 0
var mouseY = 0
var moved = 0

var imported = document.createElement('script')
imported.src = 'txt/help_'+parent.Lang+'.txt'
document.head.appendChild(imported)

function show_pad(id, sleft, s_top, swidth){
	
if(document.getElementById(id)!=null){
e=document.getElementById(id)
e.style.animationName = 'fadeAndScale_out'
e.style.webkitAnimationName = 'fadeAndScale_out'
setTimeout(function(){e.style.visibility = 'hidden'; e.parentNode.removeChild(e)}, 500)
return}

var el = if1.document.createElement('div')
el.onmousemove = move
el.onmouseup = dragStop
moved = 0

el.id=id
el.className = "hlp_fr"
el.style.left = 175+sleft+"px"
el.style.top = 25+s_top+"px"
el.style.width = swidth+"px"

el.style.visibility = 'visible'
el.onmousedown = function(){dragStart(this)}
el.onclick = function(){if(moved==1){moved=0; return}
el.style.cursor = 'default'
el.style.animationName = 'fadeAndScale_out'
el.style.webkitAnimationName = 'fadeAndScale_out'
setTimeout(function(){el.style.visibility = 'hidden'
el.parentNode.removeChild(el)}, 500)}
el.innerHTML=eval(id)
document.body.appendChild(el)
}

function show(id){
var e=document.getElementById(id)
if(e.style.visibility == 'visible') 
e.style.visibility = 'hidden'; else e.style.visibility = 'visible'
}

function dragStart(element){
dragEle = element
eleX = mouseX - dragEle.offsetLeft
eleY = mouseY - dragEle.offsetTop
}

function dragStop(dragEvent){
dragEle.style.cursor = 'default'
dragEle=null
}

function move(dragEvent){
mouseX = document.all ? window.event.clientX : dragEvent.pageX
mouseY = document.all ? window.event.clientY : dragEvent.pageY
if(dragEle != null){
moved = 1
dragEle.style.cursor = 'move'
dragEle.style.left = (mouseX - eleX) + "px"
dragEle.style.top = (mouseY - eleY) + "px"}
}
